/*
 * bright_regim.h
 *
 *  Created on: 2024 Feb 20
 *      Author: simeonidi03
 */

#ifndef INCLUDE_BRIGHT_REGIM_H_
#define INCLUDE_BRIGHT_REGIM_H_

#include <stdint.h>
#include <stddef.h>
#include <math.h>

#define TMRx_PR 100
#define LED_NUMBER 13
#define DELAY_ARRAY 48
#define BIT_NUMBER (LED_NUMBER * 24) + DELAY_ARRAY

#define BIT_ON 32
#define BIT_OFF 68

#define LED_WAVE 5//количество светодиодов в led волне

enum Regims{
	TURN_ON_ONE_LED, TURN_ON_ALL_LED, TURN_OFF_ALL_LED, BLINK_10, BLINK_2, BLINK_3, BLINK_4, WAVE
};

typedef struct
{
	uint8_t red1;
	uint8_t blue1;
	uint8_t green1;
	uint8_t red2;
	uint8_t blue2;
	uint8_t green2;
	uint8_t red3;
	uint8_t blue3;
	uint8_t green3;
	uint8_t red4;
	uint8_t blue4;
	uint8_t green4;
	uint8_t led_number;
	uint8_t count;
	uint8_t led_wave_count; //количество светодиодов в led волне
	enum Regims regim;
}work_param;


//uint16_t src_buffer[360] = { };

void led_param_init(work_param* led, enum Regims regim, int8_t led_wave_count);
void led_init(work_param* led, uint8_t led_number, int red, int green, int blue);
void all_led_init(work_param* led, uint8_t led_number, int red, int green, int blue);


void set_color(uint16_t* arr, int green, int red, int blue);
void set_led_number(uint16_t* arr, int first_led, int last_led);

// bright from 0 to 255
void set_single_led_color(uint16_t* arr, int led_number, const int red, int green, const int blue, const int bright);
void led_blink( uint16_t* src_buffer, work_param* led);
void turn_off_led(uint16_t* arr);
void led_wave( uint16_t* src_buffer, const int red, int green, const int blue);


#endif /* INCLUDE_BRIGHT_REGIM_H_ */
